package document.model;

import java.util.List;
import java.util.ArrayList;

/**
 * User: fleipold
 * Date: 28-Nov-2007
 * Time: 21:58:23
 */
public class Book {
    List<Part>  parts = new ArrayList<Part>();

    Author author;
    String title;

    public List<Part> getParts() {
        return parts;
    }

    public void setParts(List<Part> parts) {
        this.parts = parts;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public Author getAuthor() {
        return author;
    }

    public void setAuthor(Author author) {
        this.author = author;
    }

    public String toString() {
        return title;
    }

    public static Book buildExample(){
        Book book = new Book();
        book.setTitle("Domain Driven Design");
        Author evans = new Author();
        evans.setName("Eric Evans");
        evans.setShortBio("Works in software.");
        book.setAuthor(evans);
        Part part1 = new Part();
        part1.setTitle("Putting the Domain Model to Work");
        book.getParts().add(part1);
        Chapter chapter1 = new Chapter();
        chapter1.setTitle("Crunching Knowledge");
        Section section11 = new Section();
        section11.setTitle("Ingredients of Effective Modeling");
        chapter1.getSections().add(section11);

        Section section12 = new Section();
        section12.setTitle("Knowledge Crunching");
        chapter1.getSections().add(section12);  

        part1.getChapters().add(chapter1);

        Chapter chapter2 = new Chapter();
        chapter2.setTitle("Communication and the Use of Language");
        part1.getChapters().add(chapter2);

        Chapter chapter3 = new Chapter();
        chapter3.setTitle("Binding Model and Implementation");
        part1.getChapters().add(chapter3);


        Part part2 = new Part();
        part2.setTitle("The Building Blocks of a Model-Driven Design");
        book.getParts().add(part2);


        Chapter chapter4 = new Chapter();
        chapter4.setTitle("Isolating the Domain");
        part2.getChapters().add(chapter4);


        Part part3 = new Part();
        part3.setTitle("Refactoring Toward Deeper Insight");
        book.getParts().add(part3);

        Chapter chapter8 = new Chapter();
        chapter8.setTitle("Breakthrough");
        Section section81 = new Section();
        section81.setTitle("Story of a Breakthrough");
        chapter8.getSections().add(section81);


        part3.getChapters().add(chapter8);


        return book;
        
    }


}
